from django.core.management.base import LabelCommand, NoArgsCommand
from djalog.conf import settings

import logging

class Command(NoArgsCommand):
    help = "Outputs text using logging with djalog utility"

    def handle_noargs(self, **options):
        for lev in ('info', 'debug', 'warn', 'error', 'critical',):
            log = getattr(logging, lev)
            for x in xrange(5):
                log("Log some %s #%i" % (lev, x))
        if settings.LOG_SQL and hasattr(logging, 'sql'):
            for x in xrange(5):
                logging.sql("Log some sql #%i" % x)

